<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class Init extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create('im_inform', function($table)
        {
          $table->increments('id');
          $table->string('title', 140)->comment('标题');
          $table->integer('app_id')->comment('发送应用id');

          $table->integer('set_id')->comment('通知集id');
          $table->integer('event_id')->comment('事件id');
          $table->integer('sender_id')->comment('发送人id')->nullable();
          $table->string('content', 140)->comment('内容')->nullable();
          $table->boolean('is_urgent')->comment('是否紧急')->default(0);
          $table->boolean('is_notcare')->comment('是否不在乎')->default(0);

          $table->dateTime('could_send_time')->comment('可发送时间')->nullable();
          $table->boolean('close_trigger_type')->comment('关闭触发类型');
          $table->integer('close_trigger_value')->comment('关闭触发值');
          $table->dateTime('final_close_time')->comment('最晚关闭时间')->nullable();
          $table->boolean('is_reply_inform')->comment('是否有回复通知')->default(0);

          $table->boolean('is_sent')->comment('是否已发送')->default(0);
          $table->dateTime('send_time')->comment('发送时间');
          $table->smallInteger('send_count')->comment('发送人数')->default(0);

          $table->smallInteger('replied_count')->comment('回复人数')->default(0);

          $table->boolean('is_closed')->comment('是否已关闭')->default(0);
          $table->dateTime('close_time')->comment('关闭时间')->nullable();

          $table->timestamps();
          $table->softDeletes();
          $table->boolean('is_deleted')->comment('是否删除')->default(0);

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('im_inform');
    }
}
// 自增
// $table->increments('id');
// $table->bigIncrements('id');

// // 数字
// $table->integer('votes');
// $table->tinyInteger('votes');
// $table->smallInteger('votes');
// $table->mediumInteger('votes');
// $table->bigInteger('votes');
// $table->float('amount');
// $table->double('column', 15, 8);
// $table->decimal('amount', 5, 2);

// // 字符串和文本
// $table->char('name', 4);
// $table->string('email');
// $table->string('name', 100);
// $table->text('description');
// $table->mediumText('description');
// $table->longText('description');

// // 日期和时间
// $table->date('created_at');
// $table->dateTime('created_at');
// $table->time('sunrise');
// $table->timestamp('added_on');
// // Adds created_at and updated_at columns
//  // 添加 created_at 和 updated_at 行
// $table->timestamps();
// $table->nullableTimestamps();

// // 其它类型
// $table->binary('data');
// $table->boolean('confirmed');
// ->nullable()
// ->default($value)